#pragma once
#include "WndPrcoessManager.h"
#include "hook.h"
#include "MsgHook.h"

class TabDlg;

class TabLogic : public IInputHookListener ,public IMsgHookListener
{
public:
	TabLogic(TabDlg* tabDlg);
	~TabLogic(void);


	virtual bool Initialize();
	virtual void Release();

	virtual bool OnKey(WPARAM wparam, const KBDLLHOOKSTRUCT& event);
	virtual bool OnMouse(WPARAM wparam, const MSLLHOOKSTRUCT& event);

	virtual bool OnMsg(WPARAM wparam, LPARAM lParam);
private:
	void InitInputKeyToChar();

	void MakeCommonMap(DWORD orgKey, DWORD shiftKey = 0);
	void MakeSpecialMap(DWORD vkKey, DWORD orgKey, DWORD shiftKey);

	void OnAltTabStart();
	void OnAltUp();
	bool OnInputKey(DWORD);

	bool IsAltPress();
	bool IsShiftPress();

	bool IsCapitalActive();

	bool IsAlpha(DWORD key);
	DWORD GetKeyChar(DWORD key);

	TabDlg* mTabDlg;

	struct CharData
	{
		DWORD orgKey;
		DWORD shiftKey;
	};
	typedef std::map<DWORD, CharData> InputKeyToChar;
	InputKeyToChar mInputKeyToChar;
};
